#include <bits/stdc++.h>
// 2025/01/19
// tag: 
// Author: Zhang Muen
using namespace std;

string s;

string f(int l, int r){
    string ans;
    int cnt = 0, flag = false, p = 0, b = 0;
    for (int i = l; i <= r; i++){
        if (s[i] == '[')
            cnt++, flag = true;
        else if (s[i] == ']')
            cnt--;
        else if (!flag)
            ans += s[i];
        else if (cnt == 1 && isdigit(s[i]))
            p = p * 10 + s[i] - '0', b = i;
        if (cnt == 0 && flag){
            flag = false;
            string a = f(b + 1, i - 1);
            for (int j = 1; j <= p; j++)
                ans += a;
            p = 0;
        }
    }
    return ans;
}

signed main()
{
    cin >> s;
    cout << f(0, s.size() - 1);
    return 0;
}